﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using NHyperV;

namespace vmtool
{
    class Program
    {
        static void Main(string[] args)
        {
            // Command line parsing
            Arguments CommandLine = new Arguments(args);

            string serverName = CommandLine["servername"];
            if (string.IsNullOrEmpty(serverName)) 
                serverName = ".";
            string action = CommandLine["action"].ToLower();
            string vmName = CommandLine["vmname"];

            switch (action)
            {
                case "start":
                    VirtualSystem.StartVM(serverName, vmName);
                    break;
                case "stop":
                    VirtualSystem.StopVM(serverName, vmName);
                    break;
                case "reboot":
                    VirtualSystem.RebootVM(serverName, vmName);
                    break;
                case "pause":
                    VirtualSystem.PauseVM(serverName, vmName);
                    break;
                case "save":
                    VirtualSystem.SaveVM(serverName, vmName);
                    break;
                case "applysnapshot":
                    VirtualSystem.ApplySnapshot(serverName, vmName);
                    break;
                case "createsnapshot":
                    VirtualSystem.CreateSnapshot(serverName, vmName);
                    break;
                case "removesnapshot":
                    VirtualSystem.RemoveSnapshot(serverName, vmName);
                    break;
                case "removesnapshottree":
                    VirtualSystem.RemoveSnapshotTree(serverName, vmName);
                    break;
                default:
                    break;

            }

        }
    }
}
